<include file="/public/header" />
<!-- // 重定位style -->
<link href="__STATICADMIN__css/content.css?" rel="stylesheet" type="text/css" />
<div class="layui-fluid">

    <form class="layui-form layui-card" >
        <div class="layui-card-body">
	        <gt name="$data.id" value="0">
	            <input type="text" name="id" value="{$data.id}" hidden="">
	            <input type="text" name="_field_distribution" value="code" hidden="">
	            <else/>
	            <input type="text" name="id" value="" hidden="">
	        </gt>
            <div class="layui-tab layui-tab-brief"  >
                <ul class="layui-tab-title">
                  <li class="layui-this">{:__('编辑视频')}</li>
                  <li>{:__('SEO设置')}</li>
                  <li>{:__('高级选项')}</li>
                </ul>
                <div class="layui-tab-content" >
		            <div class="layui-tab-item layui-show">

		            	<div class="layui-form-item layui-form-video" >
		                    <gt name="$data.id" value="0"><input type="text" name="id" value="{$data.id}" hidden=""></gt>
		                    <input type="text" value="{$data.cid}" name="cid"  hidden="">
		                    <input type="text" value="{$data.pid}" name="pid"  hidden="">
		                    <label class="layui-form-label">{:__('视频名称')}</label>
		                    <div class="layui-input-inline" >
		                        <input type="text" name="title" autocomplete="off" value="{$data.title}" class="layui-input">
		                    </div>
		                    <label class="layui-form-label">{:__('视频分类')}</label>
							<div class="layui-input-inline" >
								<div id="pid"></div>
							</div>
							<div class="layui-input-inline" >
							  <select name="status">
							    <option value="1" <if condition="$data['status'] eq 1">selected</if> >{:__('显示')}</option>
							    <option value="0" <if condition="$data['status'] eq 0">selected</if> >{:__('隐藏')}</option>
							  </select>
							</div>
							<div class="layui-input-inline" >
		                      <select name="language">
		                        <option value="">{:__('对白')}</option>
	                            <salibs:language id="vo">
	                            <option value="{$vo}" <if condition="$vo eq $data['video']['language']">selected</if> >{$vo}</option>  
	                            </salibs:language> 
		                      </select>
							</div>
		                    <label class="layui-form-label" >{:__('影片时长')}</label>
		                    <div class="layui-input-inline" >
		                        <input type="text" name="minutes" placeholder="{:__('单位为分钟')}" value="{$data.video.minutes}" class="layui-input">
		                    </div>

		                </div>

						<div class="layui-form-item layui-form-video">
		                    <label class="layui-form-label">{:__('影片别名')}</label>
		                    <div class="layui-input-inline">
		                        <input type="text" name="alias" autocomplete="off" value="{$data.video.alias}" class="layui-input">
		                    </div> 
		                    <label class="layui-form-label">{:__('首映地区')}</label>
		                    <div class="layui-input-inline" >
		                      <select name="area">
		                        <option value="">{:__('出产地区')}</option>
	                            <salibs:arealist id="vo">
	                            <option value="{$vo}" <if condition="$vo eq $data['video']['area']">selected</if> >{$vo}</option> 
	                            </salibs:arealist> 
		                      </select>
		                    </div>                     
		                    <div class="layui-input-inline" >
		                      <select name="year">
		                        <option value="">{:__('年代')}</option>
	                            <salibs:yearlist id="vo">
	                            <option value="{$vo}" <if condition="$vo eq $data['video']['year']">selected</if> >{$vo}</option> 
	                            </salibs:yearlist> 
		                      </select>
		                    </div>  
		                    <div class="layui-input-inline"  >
		                      <select name="isfilm">
							    <option value="1" <if condition="$data['video']['isfilm'] eq 1">selected</if> >{:__('已上映')}</option>
							    <option value="0" <if condition="$data['video']['isfilm'] eq 0">selected</if> >{:__('未上映')}</option>
		                      </select>
		                    </div> 
		                    <label class="layui-form-label">{:__('播出周期')}</label>
		                    <div class="layui-input-inline" >
		                        <select name="weekday">
		                        <option value="">{:__('选择周期')}</option>
	                            <salibs:weeklist id="vo">
	                            <option value="{$vo}" <if condition="$vo eq $data['video']['weekday']">selected</if> >{$vo}</option> 
	                            </salibs:weeklist> 		                         
		                      </select>
		                    </div> 
		                </div>

		                <div class="layui-form-item layui-form-video">
		                    <label class="layui-form-label" >{:__('影片简述')}</label>
		                    <div class="layui-input-inline" style="z-index: 999">
		                        <input type="text" name="desc" autocomplete="off" value="{$data.video.desc}" class="layui-input">
		                    </div> 
		                    <label class="layui-form-label" >{:__('影片状态')}</label>
		                    <div class="layui-input-block">
								<salibs:dictionary id="vo" value="vattr" >
									<input type="checkbox" value="{$vo.value}" name="attribute[]" 
									<in name="$vo['value']" value="$data.attribute">checked=""</in> title="{$vo.name}">
                                </salibs:dictionary>
		                    </div>                                         
		                </div>

		                <div class="layui-form-item layui-form-video">
		                    <label class="layui-form-label">{:__('影片主演')}</label>
		                    <div class="layui-input-inline">
		                        <input type="text" name="actor" placeholder="{:__('主演')}" value="{$data.video.actor}" class="layui-input">
		                    </div>  
		                    <label class="layui-form-label" >{:__('影片标签')}</label>
		                    <div class="layui-input-inline">
		                        <input type="text" name="class" placeholder="{:__('科幻，战争')}" value="{$data.video.class}" class="layui-input">
		                    </div>  
		                    <div class="layui-input-inline">
		                        <input type="text" name="continu" placeholder="{:__('当前连载')}" value="{$data.video.continu}" class="layui-input">
		                    </div> 

		                    <div class="layui-input-inline">
		                        <input type="text" name="total" placeholder="{:__('总集数')}" value="{$data.video.total}" class="layui-input">
		                    </div> 		          		                 
 
		                    <label class="layui-form-label" >{:__('备注信息')}</label>
		                    <div class="layui-input-inline">
		                        <input type="text" name="marks" placeholder="{:__('备注信息')}" value="{$data.video.marks}" class="layui-input">
		                    </div>                                     
		                </div>

		                <div class="layui-form-item layui-form-fixday">
		                    <label class="layui-form-label">{:__('影片导演')}</label>
		                    <div class="layui-input-inline">
		                        <input type="text" name="director" placeholder="{:__('导演')}" value="{$data.video.director}" class="layui-input">
		                    </div>  
  
		                    <label class="layui-form-label" >{:__('上映日期')}</label>
		                    <div class="layui-input-inline">
		                        <input type="text" name="filmtime" placeholder="yyyy-MM-dd" lay-datetime value="{$data.video.filmtime}" class="layui-input">
		                    </div> 
		                    <label class="layui-form-label" >{:__('更新日期')}</label>
		                    <div class="layui-input-inline">
		                        <input type="text" value="{$data.updatetime|default=''}" class="layui-input">
		                    </div>                                        
		                </div>	   
		                <div class="layui-form-item">
		                    <label class="layui-form-label" >{:__('关键TAG')}</label>
		                    <div class="layui-input-inline wid650">
		                        <input type="text" id="keywords" lay-tags="" name="keywords" placeholder="{:__('请输入SEO关键词')}" value="{$data.keywords}" class="layui-input">
		                    </div>                                          
		                </div>             
		                <div class="layui-form-item">
		                    <label class="layui-form-label" >{:__('微缩图')}</label>
		                    <div class="layui-input-inline wid550" >
		                        <input type="text" name="thumb" placeholder="{:__('请上传微缩图')}" lay-image-hover="" value="{$data.thumb}" class="layui-input thumb">
		                    </div>   
		                    
		                    <button type="button" class="layui-btn" lay-upload="thumb" >{:__('上传图片')}</button>
		                </div> 

		                <div class="layui-form-item">
		                    <label class="layui-form-label" >{:__('海报剧照')}</label>
		                    <div class="layui-input-inline wid550" >
		                        <input type="text" name="image" lay-image-hover="" 
		                        placeholder="{:__('请上传影片剧照')}" value="{$data.image}" class="layui-input image">
		                    </div>   

		                    <button type="button" class="layui-btn" lay-upload="image" >{:__('上传封面')}</button>
		                </div> 
		                <div class="layui-form-item">
		                    <label class="layui-form-label" >{:__('首页幻灯片')}</label>
		                    <div class="layui-input-inline wid550" >
		                        <input type="text" name="banner" lay-image-hover="" 
		                        placeholder="{:__('请上传幻灯片')}" value="{$data.video.banner|default=''}" class="layui-input banner">
		                    </div>   
		                    <button type="button" class="layui-btn" lay-upload="banner" >{:__('上传幻灯片')}</button>
		                </div>  
		                <div id="player_list" class="layui-player-list">
		                <notempty name="data['video']['play']">
		                    <volist name="data['video']['play']" id="vo" key="key">
			                    <?php $parent_key = $key; ?>
			                    <div class="layui-form-item" data-i="{$key}" >
			                        <label class="layui-form-label" >{:__('播放地址')}{$key}</label>
			                        <div class="layui-input-inline" >
			                          <select name="play[{$parent_key}]" data-player>
			                            <option value="">{:__('请选择播放器')}</option>
			                            <salibs:playlist id="play">
			                            <option value="{$play.name}" <if condition="$play.name eq $vo">selected</if> >{$play.title}</option>
			                            </salibs:playlist> 
			                          </select>
			                        </div>

			                        <div class="layui-input-inline">
			                          <select name="server[{$parent_key}]" data-server>
			                            <option value="">{:__('请选择服务器')}</option>
			                            <salibs:serverlist id="server">
			                            <option value="{$server.name}" <notempty name="$data['video']['server'][$parent_key-1]"> <if condition="$server.name eq $data['video']['server'][$parent_key-1]">selected</if> </notempty> >{$server.title}</option>
			                            </salibs:serverlist>
			                          </select>
			                        </div>

			                        <div class="layui-input-inline">
			                            <input type="text" name="note[{$parent_key}]" placeholder="{:__('请输入备注')}"  class="layui-input" 
			                            <notempty name="$data['video']['note'][$parent_key-1]"> value="{$data.video.note[($parent_key-1)]}" </notempty> >
			                        </div>
			                        <p class="layui-clear"></p>
			                        <!-- 循环输出每个播放数据 -->
			                        <div class="layui-input-block layui-data-urls"> 
			                            <textarea name="url[{$parent_key}]" class="layui-textarea" >{$data.video.url[($parent_key-1)]}</textarea>
			                        </div>                                                                                        
			                    </div>
		                    </volist>
	                    </notempty>
	                	</div>

	                	<div class="layui-form-item">
			                <div class="layui-input-inline" >
			                    <label class="layui-form-label" ></label>
			                    <button type="button" class="layui-btn" id="layui-add-play">{:__('增加一组播放')}</button>
			                </div> 
		            	</div>

		                <div class="layui-form-item">
		                    <label class="layui-form-label">{:__('详细介绍')}</label>
		                    <div class="layui-input-block">
		                        <textarea id="content" lay-editor="" name="content" class="layui-hide">{$data.video.content}</textarea>
		                    </div>
		                </div>
		                          
		            </div>

					<div class="layui-tab-item">
		                <div class="layui-form-item">
		                    <label class="layui-form-label">{:__('独立模板')}</label>
		                    <div class="layui-input-inline">
		                    	<select name="skin">
		                    		<option value=""></option>
		                    		<salibs:customtpl id="vo">
		                    		<option value="{$vo}" <if condition="$vo eq $data['skin']"> selected </if> >{$vo}</option>
		                    		</salibs:customtpl>
		                    	</select>
		                    </div>  		               
		                </div> 	
		                <div class="layui-form-item">
		                    <label class="layui-form-label" >{:__('SEO标题')}</label>
		                    <div class="layui-input-inline wid650">
		                        <input type="text" name="seotitle" placeholder="{:__('请输入SEO标题')}" value="{$data.seotitle}" class="layui-input">
		                    </div>                                          
		                </div>

		                <div class="layui-form-item">
		                    <label class="layui-form-label" >{:__('SEO简介')}</label>
		                    <div class="layui-input-inline wid650">
		                        <textarea name="description" placeholder="{:__('请输入SEO描述信息')}" class="layui-textarea" >{$data.description}</textarea>
		                    </div>                                          
		                </div>

		                <div class="layui-form-item" >
		                    <label class="layui-form-label" >{:__('采集来源')}</label>
		                    <div class="layui-input-inline wid650">
		                        <input type="text" name="reurl" placeholder="http://" value="{$data.reurl}" class="layui-input">
		                    </div>
		                </div>
		                <div class="layui-form-item" >
		                    <label class="layui-form-label" >{:__('跳转地址')}</label>
		                    <div class="layui-input-inline wid650">
		                        <input type="text" name="jumpurl" placeholder="https://" value="{$data.jumpurl}" class="layui-input">
		                    </div>
		                </div>	
					</div>


                    <div class="layui-tab-item">
		                <div class="layui-form-item">
		                    <label class="layui-form-label">{:__('推荐星级')}</label>
		                    <div class="layui-input-inline">
		                        <input class="stars" type="text" name="stars" value="{$data.stars}"  hidden="" >
		                        <div lay-rate="stars" data-value="{$data.stars}" data-class="stars" data-theme="#1890ff" ></div>
		                    </div>
		                    <label class="layui-form-label">{:__('标题颜色')}</label>
		                    <div class="layui-input-inline">
		                        <input class="color" type="text" name="color" value="{$data.color}"  hidden="" >
		                        <div class="picker" lay-colorpicker="color" data-value ="{$data.color}" ></div>
		                    </div>
		                </div>	

		                <div class="layui-form-item">
		                    <label class="layui-form-label">{:__('浏览权限')}</label>
		                    <div class="layui-input-inline">
		                    	<div id="access"></div>
		                    </div>
		                    <label class="layui-form-label">{:__('文章排序')}</label>
		                    <div class="layui-input-inline">
								<input type="number" name="sort" class="layui-input" value="{$data.sort}" >
		                    </div>                    
		                </div>

		                <div class="layui-form-item">
		                    <label class="layui-form-label">{:__('所需积分')}</label>
		                    <div class="layui-input-inline">
		                        <input type="text" name="score" autocomplete="off" value="{$data.score}" class="layui-input">
		                    </div>  		                
		                    <label class="layui-form-label">{:__('首字母')}</label>
		                    <div class="layui-input-inline">
		                        <input type="text" name="letter" autocomplete="off" value="{$data.letter}" class="layui-input">
		                    </div>
                  
		                </div>

		                <div class="layui-form-item">
		                    <label class="layui-form-label">{:__('日人气')}</label>
		                    <div class="layui-input-inline">
		                        <input type="text" name="hits_day" autocomplete="off" value="{$data.hits_day}" class="layui-input">
		                    </div>
		                    <label class="layui-form-label">{:__('周人气')}</label>
		                    <div class="layui-input-inline">
		                        <input type="text" name="hits_week" autocomplete="off" value="{$data.hits_week}" class="layui-input">
		                    </div>                    
		                </div>    

		                <div class="layui-form-item">
		                    <label class="layui-form-label">{:__('月人气')}</label>
		                    <div class="layui-input-inline">
		                        <input type="text" name="hits_month" autocomplete="off" value="{$data.hits_month}" class="layui-input">
		                    </div>
		                    <label class="layui-form-label">{:__('总人气')}</label>
		                    <div class="layui-input-inline">
		                        <input type="text" name="hits" autocomplete="off" value="{$data.hits}" class="layui-input">
		                    </div>                    
		                </div>                
		            
		                <div class="layui-form-item">
		                    <label class="layui-form-label">{:__('评分值')}</label>
		                    <div class="layui-input-inline">
		                        <input type="text" name="gold" autocomplete="off" value="{$data.gold}" class="layui-input">
		                    </div>
		                    <label class="layui-form-label">{:__('评分人数')}</label>
		                    <div class="layui-input-inline">
		                        <input type="text" name="golder" autocomplete="off" value="{$data.golder}" class="layui-input">
		                    </div>                    
		                </div>

		                <div class="layui-form-item">
		                    <label class="layui-form-label">{:__('顶一下')}</label>
		                    <div class="layui-input-inline">
		                        <input type="text" name="up" autocomplete="off" value="{$data.up}" class="layui-input">
		                    </div>
		                    <label class="layui-form-label">{:__('踩一下')}</label>
		                    <div class="layui-input-inline">
		                        <input type="text" name="down" autocomplete="off" value="{$data.down}" class="layui-input">
		                    </div>                    
		                </div>

		                <div class="layui-form-item">		               
		                    <label class="layui-form-label">{:__('录入编辑')}</label>
		                    <div class="layui-input-inline">
		                        <input type="text" name="author" placeholder="admin" value="{$data.author}" class="layui-input">
		                    </div>    
		                </div>		       
                    </div>
                </div>
          	</div>
        </div>
    
        <div class="layui-footer layui-form-footer" >
            <button class="layui-btn layui-btn-primary" type="button" sa-event="closeDialog">{:__('取消')}</button>
            <button class="layui-btn" lay-filter="submitIframe" type="button" lay-submit reload="false" >{:__('提交')}</button>
        </div>
    </form>
</div>
<include file="/public/footer" />

<!-- // 列表工具栏 -->
<script type="text/html" id="player">
    <option value="">请选择播放器</option>
    <salibs:playlist id="play">
    <option value="{$play.name}" >{$play.title}</option>
    </salibs:playlist> 
</script>

<script type="text/html" id="server">
	<option value="">请选择服务器</option>
	<salibs:serverlist id="server">
	<option value="{$server.name}" >{$server.title}</option>
	</salibs:serverlist> 
</script>

<script>
    layui.use(['admin','content'], function () {

        var jquery = layui.jquery;
        var admin = layui.admin;
        var content = layui.content;

		var groupList = {:htmlspecialchars_decode($UserGroup)};
		var categoryList = {:htmlspecialchars_decode($categoryList)};
        // 常规元素渲染
		content.xmselect('pid',categoryList,[{$data.pid}],false);
		content.xmselect('access',groupList,[{$data.access}]);

  		jquery('#layui-add-play').on('click',function(){
  			var player = jquery('*[data-i]');
  			player = player.length+1;
	        var player_select = jquery('#player').html();
	        var server_select =	jquery('#server').html();
  			var tpl='<div class="layui-form-item"data-i="'+player+'">';
  			tpl += '<label class="layui-form-label">播放地址'+(player)+'</label>';
  			tpl += '<div class="layui-input-inline"><select name="play['+(player)+']">'+player_select+'</select></div>';
  			tpl += '<div class="layui-input-inline"><select name="server['+(player)+']">'+server_select+'</select></div>';
  			tpl += '<div class="layui-input-inline"><input type="text"name="note[]"class="layui-input"placeholder="备注信息"></div>';
  			tpl += '<p class="layui-clear"></p>';
  			tpl += '<div class="layui-input-block layui-data-urls""><textarea name="url['+(player)+']"';
			tpl += 'class="layui-textarea" placeholder="course$http://v.myalicdn.com/live/cctv/index.m3u8"></textarea></div></div>';
            jquery("#player_list").append(tpl);
  			layui.form.render();
  		})
    });
</script>
